package com.dt.platform.hr.controller;

import java.util.*;
import com.dt.platform.constants.enums.common.StatusEnableEnum;
import com.dt.platform.domain.hr.LearnRelease;
import com.dt.platform.domain.hr.Paper;
import com.dt.platform.domain.hr.meta.LearnReleaseMeta;
import com.dt.platform.hr.service.IPaperService;
import com.dt.platform.proxy.hr.LearnReleaseServiceProxy;
import com.github.foxnic.commons.busi.id.IDGenerator;
import org.apache.commons.lang3.StringUtils;
import org.github.foxnic.web.framework.web.SuperController;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import com.github.foxnic.commons.collection.CollectorUtil;
import com.github.foxnic.dao.entity.ReferCause;
import com.github.foxnic.api.swagger.InDoc;
import org.github.foxnic.web.framework.sentinel.SentinelExceptionUtil;
import com.github.foxnic.api.swagger.ApiParamSupport;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.dt.platform.proxy.hr.PaperReleaseServiceProxy;
import com.dt.platform.domain.hr.meta.PaperReleaseVOMeta;
import com.dt.platform.domain.hr.PaperRelease;
import com.dt.platform.domain.hr.PaperReleaseVO;
import com.github.foxnic.api.transter.Result;
import com.github.foxnic.dao.data.SaveMode;
import com.github.foxnic.dao.excel.ExcelWriter;
import com.github.foxnic.springboot.web.DownloadUtil;
import com.github.foxnic.dao.data.PagedList;
import java.util.Date;
import java.sql.Timestamp;
import com.github.foxnic.api.error.ErrorDesc;
import com.github.foxnic.commons.io.StreamUtil;
import java.util.Map;
import com.github.foxnic.dao.excel.ValidateResult;
import java.io.InputStream;
import com.dt.platform.domain.hr.meta.PaperReleaseMeta;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.dt.platform.hr.service.IPaperReleaseService;
import com.github.foxnic.api.validate.annotations.NotNull;

/**
 * <p>
 * 考试下发接口控制器
 * </p>
 * @author 金杰 , maillank@qq.com
 * @since 2024-09-14 13:53:00
 */
@InDoc
@Api(tags = "考试下发")
@RestController("HrPaperReleaseController")
public class PaperReleaseController extends SuperController {

    @Autowired
    private IPaperReleaseService paperReleaseService;

    @Autowired
    private IPaperService paperService;

    /**
     * 添加考试下发
     */
    @ApiOperation(value = "添加考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.PAPER_ID, value = "当前试卷", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.CODE, value = "编号", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RCD_TIME, value = "下发时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.UPDATE_BY, value = "修改人ID", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.STATUS, value = "启用状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.LEARN_ID, value = "学习课件", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_LEARN, value = "关联学习", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.COST, value = "考试用时", required = false, dataTypeClass = Integer.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SDATE, value = "开始时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.EDATE, value = "结束时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_ALL_USER, value = "是否全员", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SEL_ORG, value = "选择部门", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RELEASE_STATUS, value = "下发状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SOURCE_PAPER_ID, value = "原始试卷", required = false, dataTypeClass = String.class)
	})
    @ApiParamSupport(ignoreDBTreatyProperties = true, ignoreDefaultVoProperties = true, ignorePrimaryKey = true)
    @ApiOperationSupport(order = 1, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.INSERT, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.INSERT)
    public Result insert(PaperReleaseVO paperReleaseVO) {
        Result result = paperReleaseService.insert(paperReleaseVO, false);
        return result;
    }

    /**
     * 作废
     */
    @ApiOperation(value = "作废")
    @ApiOperationSupport(order = 2, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.CANCEL, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.CANCEL)
    public Result cancel(String id) {
        return paperReleaseService.cancel(id);
    }

    /**
     * 删除考试下发
     */
    @ApiOperation(value = "删除考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class)
	})
    @ApiOperationSupport(order = 2, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.DELETE, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.DELETE)
    public Result deleteById(String id) {
        this.validator().asserts(id).require("缺少id值");
        if (this.validator().failure()) {
            return this.validator().getFirstResult();
        }
        // 引用校验
        ReferCause cause = paperReleaseService.hasRefers(id);
        // 判断是否可以删除
        this.validator().asserts(cause.hasRefer()).requireEqual("不允许删除当前记录：" + cause.message(), false);
        if (this.validator().failure()) {
            return this.validator().getFirstResult().messageLevel4Confirm();
        }
        Result result = paperReleaseService.deleteByIdLogical(id);
        return result;
    }

    /**
     * 下发
     */
    @ApiOperation(value = "下发")
    @ApiOperationSupport(order = 2, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.RELEASE, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.RELEASE)
    public Result release(String id, String paperId) {
        return paperReleaseService.release(id);
    }

    /**
     * 批量删除考试下发 <br>
     * 联合主键时，请自行调整实现
     */
    @ApiOperation(value = "批量删除考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.IDS, value = "主键清单", required = true, dataTypeClass = List.class, example = "[1,3,4]")
	})
    @ApiOperationSupport(order = 3, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.DELETE_BY_IDS, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.DELETE_BY_IDS)
    public Result deleteByIds(List<String> ids) {
        // 参数校验
        this.validator().asserts(ids).require("缺少ids参数");
        if (this.validator().failure()) {
            return this.validator().getFirstResult();
        }
        // 查询引用
        Map<String, ReferCause> causeMap = paperReleaseService.hasRefers(ids);
        // 收集可以删除的ID值
        List<String> canDeleteIds = new ArrayList<>();
        for (Map.Entry<String, ReferCause> e : causeMap.entrySet()) {
            if (!e.getValue().hasRefer()) {
                canDeleteIds.add(e.getKey());
            }
        }
        // 执行删除
        if (canDeleteIds.isEmpty()) {
            // 如果没有一行可以被删除
            return ErrorDesc.failure().message("无法删除您选中的数据行：").data(0).addErrors(CollectorUtil.collectArray(CollectorUtil.filter(causeMap.values(), (e) -> {
                return e.hasRefer();
            }), ReferCause::message, String.class)).messageLevel4Confirm();
        } else if (canDeleteIds.size() == ids.size()) {
            // 如果全部可以删除
            Result result = paperReleaseService.deleteByIdsLogical(canDeleteIds);
            return result;
        } else if (canDeleteIds.size() > 0 && canDeleteIds.size() < ids.size()) {
            // 如果部分行可以删除
            Result result = paperReleaseService.deleteByIdsLogical(canDeleteIds);
            if (result.failure()) {
                return result;
            } else {
                return ErrorDesc.success().message("已删除 " + canDeleteIds.size() + " 行，但另有 " + (ids.size() - canDeleteIds.size()) + " 行数据无法删除").data(canDeleteIds.size()).addErrors(CollectorUtil.collectArray(CollectorUtil.filter(causeMap.values(), (e) -> {
                    return e.hasRefer();
                }), ReferCause::message, String.class)).messageLevel4Confirm();
            }
        } else {
            // 理论上，这个分支不存在
            return ErrorDesc.success().message("数据删除未处理");
        }
    }

    /**
     * 更新考试下发
     */
    @ApiOperation(value = "更新考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.PAPER_ID, value = "当前试卷", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.CODE, value = "编号", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RCD_TIME, value = "下发时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.UPDATE_BY, value = "修改人ID", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.STATUS, value = "启用状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.LEARN_ID, value = "学习课件", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_LEARN, value = "关联学习", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.COST, value = "考试用时", required = false, dataTypeClass = Integer.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SDATE, value = "开始时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.EDATE, value = "结束时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_ALL_USER, value = "是否全员", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SEL_ORG, value = "选择部门", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RELEASE_STATUS, value = "下发状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SOURCE_PAPER_ID, value = "原始试卷", required = false, dataTypeClass = String.class)
	})
    @ApiParamSupport(ignoreDBTreatyProperties = true, ignoreDefaultVoProperties = true)
    @ApiOperationSupport(order = 4, author = "金杰 , maillank@qq.com", ignoreParameters = { PaperReleaseVOMeta.PAGE_INDEX, PaperReleaseVOMeta.PAGE_SIZE, PaperReleaseVOMeta.SEARCH_FIELD, PaperReleaseVOMeta.FUZZY_FIELD, PaperReleaseVOMeta.SEARCH_VALUE, PaperReleaseVOMeta.DIRTY_FIELDS, PaperReleaseVOMeta.SORT_FIELD, PaperReleaseVOMeta.SORT_TYPE, PaperReleaseVOMeta.DATA_ORIGIN, PaperReleaseVOMeta.QUERY_LOGIC, PaperReleaseVOMeta.REQUEST_ACTION, PaperReleaseVOMeta.IDS })
    @SentinelResource(value = PaperReleaseServiceProxy.UPDATE, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.UPDATE)
    public Result update(PaperReleaseVO paperReleaseVO) {
        Result result = paperReleaseService.update(paperReleaseVO, SaveMode.DIRTY_OR_NOT_NULL_FIELDS, false);
        return result;
    }

    /**
     * 保存考试下发
     */
    @ApiOperation(value = "保存考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.PAPER_ID, value = "当前试卷", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.CODE, value = "编号", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RCD_TIME, value = "下发时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.UPDATE_BY, value = "修改人ID", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.STATUS, value = "启用状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.LEARN_ID, value = "学习课件", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_LEARN, value = "关联学习", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.COST, value = "考试用时", required = false, dataTypeClass = Integer.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SDATE, value = "开始时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.EDATE, value = "结束时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_ALL_USER, value = "是否全员", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SEL_ORG, value = "选择部门", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RELEASE_STATUS, value = "下发状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SOURCE_PAPER_ID, value = "原始试卷", required = false, dataTypeClass = String.class)
	})
    @ApiParamSupport(ignoreDBTreatyProperties = true, ignoreDefaultVoProperties = true)
    @ApiOperationSupport(order = 5, ignoreParameters = { PaperReleaseVOMeta.PAGE_INDEX, PaperReleaseVOMeta.PAGE_SIZE, PaperReleaseVOMeta.SEARCH_FIELD, PaperReleaseVOMeta.FUZZY_FIELD, PaperReleaseVOMeta.SEARCH_VALUE, PaperReleaseVOMeta.DIRTY_FIELDS, PaperReleaseVOMeta.SORT_FIELD, PaperReleaseVOMeta.SORT_TYPE, PaperReleaseVOMeta.DATA_ORIGIN, PaperReleaseVOMeta.QUERY_LOGIC, PaperReleaseVOMeta.REQUEST_ACTION, PaperReleaseVOMeta.IDS })
    @SentinelResource(value = PaperReleaseServiceProxy.SAVE, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.SAVE)
    public Result save(PaperReleaseVO paperReleaseVO) {
        Result result = paperReleaseService.save(paperReleaseVO, SaveMode.DIRTY_OR_NOT_NULL_FIELDS, false);
        return result;
    }

    /**
     * 获取考试下发
     */
    @ApiOperation(value = "获取考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class, example = "1")
	})
    @ApiOperationSupport(order = 6, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.GET_BY_ID, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.GET_BY_ID)
    public Result<PaperRelease> getById(String id) {
        Result<PaperRelease> result = new Result<>();
        PaperRelease paperRelease = paperReleaseService.getById(id);
        paperReleaseService.dao().fill(paperRelease).with(PaperReleaseMeta.SELECT_USER).with(PaperReleaseMeta.SELECT_ORG).with(PaperReleaseMeta.LEARN).execute();
        result.success(true).data(paperRelease);
        return result;
    }




    /**
     * 批量获取考试下发 <br>
     * 联合主键时，请自行调整实现
     */
    @ApiOperation(value = "批量获取考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.IDS, value = "主键清单", required = true, dataTypeClass = List.class, example = "[1,3,4]")
	})
    @ApiOperationSupport(order = 3, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.GET_BY_IDS, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.GET_BY_IDS)
    public Result<List<PaperRelease>> getByIds(List<String> ids) {
        Result<List<PaperRelease>> result = new Result<>();
        List<PaperRelease> list = paperReleaseService.queryListByIds(ids);
        result.success(true).data(list);
        return result;
    }

    /**
     * 查询考试下发
     */
    @ApiOperation(value = "查询考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.PAPER_ID, value = "当前试卷", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.CODE, value = "编号", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RCD_TIME, value = "下发时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.UPDATE_BY, value = "修改人ID", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.STATUS, value = "启用状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.LEARN_ID, value = "学习课件", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_LEARN, value = "关联学习", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.COST, value = "考试用时", required = false, dataTypeClass = Integer.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SDATE, value = "开始时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.EDATE, value = "结束时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_ALL_USER, value = "是否全员", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SEL_ORG, value = "选择部门", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RELEASE_STATUS, value = "下发状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SOURCE_PAPER_ID, value = "原始试卷", required = false, dataTypeClass = String.class)
	})
    @ApiOperationSupport(order = 5, author = "金杰 , maillank@qq.com", ignoreParameters = { PaperReleaseVOMeta.PAGE_INDEX, PaperReleaseVOMeta.PAGE_SIZE })
    @SentinelResource(value = PaperReleaseServiceProxy.QUERY_LIST, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.QUERY_LIST)
    public Result<List<PaperRelease>> queryList(PaperReleaseVO sample) {
        Result<List<PaperRelease>> result = new Result<>();
        List<PaperRelease> list = paperReleaseService.queryList(sample);
        result.success(true).data(list);
        return result;
    }

    /**
     * 分页查询考试下发
     */
    @ApiOperation(value = "分页查询考试下发")
    @ApiImplicitParams({
		@ApiImplicitParam(name = PaperReleaseVOMeta.ID, value = "主键", required = true, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.PAPER_ID, value = "当前试卷", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.CODE, value = "编号", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RCD_TIME, value = "下发时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.UPDATE_BY, value = "修改人ID", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.STATUS, value = "启用状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.LEARN_ID, value = "学习课件", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_LEARN, value = "关联学习", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.COST, value = "考试用时", required = false, dataTypeClass = Integer.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SDATE, value = "开始时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.EDATE, value = "结束时间", required = false, dataTypeClass = Date.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.IF_ALL_USER, value = "是否全员", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SEL_ORG, value = "选择部门", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.RELEASE_STATUS, value = "下发状态", required = false, dataTypeClass = String.class),
		@ApiImplicitParam(name = PaperReleaseVOMeta.SOURCE_PAPER_ID, value = "原始试卷", required = false, dataTypeClass = String.class)
	})
    @ApiOperationSupport(order = 8, author = "金杰 , maillank@qq.com")
    @SentinelResource(value = PaperReleaseServiceProxy.QUERY_PAGED_LIST, blockHandlerClass = { SentinelExceptionUtil.class }, blockHandler = SentinelExceptionUtil.HANDLER)
    @PostMapping(PaperReleaseServiceProxy.QUERY_PAGED_LIST)
    public Result<PagedList<PaperRelease>> queryPagedList(PaperReleaseVO sample) {
        Result<PagedList<PaperRelease>> result = new Result<>();
        PagedList<PaperRelease> list = paperReleaseService.queryPagedList(sample, sample.getPageSize(), sample.getPageIndex());
        paperReleaseService.dao().fill(list).with(PaperReleaseMeta.LEARN).execute();
        result.success(true).data(list);
        return result;
    }
}
